import router from "../../router/router";

const permission = {

    state: {
        routes: []
    },
    mutations: {
        SET_ROUTES: (state, routes) => {
            state.addRoutes = routes
            state.routes = router.concat(routes)
        }
    },
    action: {
        // 生成路由
        GENERATE_ROUTER({commit}) {
            // 向后端请求路由数据
            getRouters().then(res => {
                console.log(res)
                const sdata = JSON.parse(JSON.stringify(res.data))
                commit('SET_ROUTES', sdata)
            })
        }
    }

}
